# 工地相关违法事件筛选
from Lib.base.keywords import KeyWords
from selenium.webdriver.common.by import By
from Lib.common.common_function import *
from Lib.base.page_object.login_page import LonginPage
import uuid
import random


class Event(KeyWords):

    def create_event(self):
        '''
        创建工地相关的事件
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\site_manage\event\create_event.yaml')
        element_operation(self, data[0]['data'])

    def event_list(self):
        '''
        创建工地相关的事件列表
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\site_manage\event\event_list.yaml')
        element_operation(self, data[0]['data'])

    def event_search_and_detail(self):
        data = get_data_by_yaml(get_path() + r'\Data\element_data\site_manage\event\event_search_and_detail.yaml')
        element_operation(self, data[0]['data'])


if __name__ == '__main__':
    try:
        driver = choose_browser()
        L = LonginPage(driver)
        L.login('kobeAdmin002', 'kobe8888')
        case = Event(driver)
        case.event_search_and_detail()
    except Exception as e:
        driver.quit()
        raise e
    else:
        driver.quit()
